// Package sys
// @Link  https://github.com/bufanyun/hotgo
// @Copyright  Copyright (c) 2025 HotGo CLI
// @Author  Ms <133814250@qq.com>
// @License  https://github.com/bufanyun/hotgo/blob/master/LICENSE
// @AutoGenerate Version 2.15.11
package sys

import (
	"context"
	"hotgo/api/admin/auctionlog"
	"hotgo/internal/model/input/sysin"
	"hotgo/internal/service"
)

var (
	AuctionLog = cAuctionLog{}
)

type cAuctionLog struct{}

// List 查看竞拍记录列表
func (c *cAuctionLog) List(ctx context.Context, req *auctionlog.ListReq) (res *auctionlog.ListRes, err error) {
	list, totalCount, err := service.SysAuctionLog().List(ctx, &req.AuctionLogListInp)
	if err != nil {
		return
	}

	if list == nil {
		list = []*sysin.AuctionLogListModel{}
	}

	res = new(auctionlog.ListRes)
	res.List = list
	res.PageRes.Pack(req, totalCount)
	return
}

// Export 导出竞拍记录列表
func (c *cAuctionLog) Export(ctx context.Context, req *auctionlog.ExportReq) (res *auctionlog.ExportRes, err error) {
	err = service.SysAuctionLog().Export(ctx, &req.AuctionLogListInp)
	return
}

// Edit 更新竞拍记录
func (c *cAuctionLog) Edit(ctx context.Context, req *auctionlog.EditReq) (res *auctionlog.EditRes, err error) {
	err = service.SysAuctionLog().Edit(ctx, &req.AuctionLogEditInp)
	return
}

// View 获取指定竞拍记录信息
func (c *cAuctionLog) View(ctx context.Context, req *auctionlog.ViewReq) (res *auctionlog.ViewRes, err error) {
	data, err := service.SysAuctionLog().View(ctx, &req.AuctionLogViewInp)
	if err != nil {
		return
	}

	res = new(auctionlog.ViewRes)
	res.AuctionLogViewModel = data
	return
}

// Delete 删除竞拍记录
func (c *cAuctionLog) Delete(ctx context.Context, req *auctionlog.DeleteReq) (res *auctionlog.DeleteRes, err error) {
	err = service.SysAuctionLog().Delete(ctx, &req.AuctionLogDeleteInp)
	return
}